'------------------------------
' Hien thi 5 tin moi nhat
'------------------------------
Imports System
Imports System.Web
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports DotNetNuke
Namespace NVPortal.Modules.NVNews

    Public MustInherit Class TopView
        Inherits Entities.Modules.PortalModuleBase

#Region "Event Handlers"

        Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Try
                If Not IsPostBack Then
                    Dim ctlNews As New NV_NewsController
                    Dim arrNews As ArrayList
                    arrNews = ctlNews.TopNew(7, 0)
                    Me.drgOtherNews.DataSource = arrNews
                    Me.drgOtherNews.DataBind()
                End If
            Catch ex As Exception
                'Me.imgNews.Visible = False
                'Exception
                ProcessModuleLoadException(Me, ex)
            End Try
        End Sub
        Public Function CatName(ByVal catid As String) As String
            Dim ctlCat As New NV_NewsCategoriesController
            Dim objCat As NV_NewsCategoriesInfo
            objCat = ctlCat.GetByID(catid)
            Return objCat.CategoryName
        End Function
        Public Function FormatURL(ByVal sitem As String, ByVal strID As String, ByVal strLink As String) As String
            Dim i As Integer
            If IsNumeric(Settings("NVNewsDisplayPageSetting")) Then
                i = Settings("NVNewsDisplayPageSetting")
                Return "/" & sitem & "/" & strID & "/" & ReplaceChuoi(strLink) & ".htm"
            Else
                Return "/" & sitem & "/" & strID & "/" & ReplaceChuoi(strLink) & ".htm"
            End If
        End Function
        Public Function FormatURLcat(ByVal sitem As String, ByVal strID As String, ByVal strLink As String) As String
            Return "/" & sitem & "/" & strID & "/" & ReplaceChuoi(strLink) & ".htm"
        End Function
        Public Function ReplaceChuoi(ByVal chuoi As String) As String
            Dim convert As String = Global.ReplaceChuoi.bodau(chuoi).Replace(" ", "-")
            Return convert
        End Function
#End Region
    End Class

End Namespace
